﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cesave.Infrastructure.Data.Core;
using Cesave.Domain.PermisosModule.Entities;
using Cesave.Domain.PermisosModule.Contracts.Ejidos;
using Cesave.Infrastructure.Data.PermisosModule.Context;
using Cesave.Infrastructure.CrossCutting.Logging;

namespace Cesave.Infrastructure.Data.PermisosModule.Repositories
{
	/// <summary>
	/// 
	/// </summary>
	public class EjidoRepository
		: GenericRepositoryEx<Ejido>, IEjidoRepository
	{
		#region Constructor

		/// <summary>
		/// 
		/// </summary>
		/// <param name="context"></param>
		/// <param name="traceManager"></param>
		public EjidoRepository(IPermisosModuleContext context, ITraceManager traceManager)
			: base(context, traceManager)
		{
		}

		#endregion

		#region IEjidoRepository Members

		/// <summary>
		/// 
		/// </summary>
		/// <param name="specification"></param>
		/// <returns></returns>
		public IEnumerable<Ejido> FindEjidosByMunicipio(EjidosByMunicipioSpecification specification)
		{
			if (specification == null)
				throw new ArgumentNullException("specification");
			return GetBySpec(specification).OrderBy(e => e.Nombre);
		}

		#endregion
	}
}
